import { Link } from '@brillout/docpress'
import { JustAMiddleware, IntegrationHelp } from '../../components'
import { PhotonDescription } from '../vike-photon/components'

To integrate Vike with a JavaScript server, we recommend using the <Link href="/vike-photon">`vike-photon` extension</Link> which <PhotonDescription />

But you can also manually integrate Vike into your server for full control over your server and deployment.


## Manual integration

<JustAMiddleware />

> Your server code won't be transpiled by [Vite](https://vite.dev) out of the box, see [#562 - Transpile server code](https://github.com/vikejs/vike/issues/562) for a list of tools to transpile server code (e.g. to support TypeScript).

> If you want to use HTTPS in development, [pass the HTTPS certificates to Vite's dev server](https://vitejs.dev/config/server-options.html#server-https).

You can use:
- Any server framework (Express, Fastify, Hono, Nitro, Hattip, Koa, Hapi, ...)
- Any authentication strategy/tool (email/password, OAuth, Auth.js, Passport.js, Grant, Keycloak, Auth0, ...).
- Any serverless/edge environment (Cloudflare Workers, Vercel, Firebase, AWS Lambda, Google Cloud Functions, Deno Deploy, ...)
- Any virtual private server (AWS EC2, Google Cloud, ...)
- Any static host (Cloudflare Pages, GitHub Pages, Netlify, ...)
- Any server utility (Docker, Nginx, PM2, ...)

Examples:

- <Link href="/express" />
- <Link href="/hono" />
- <Link href="/fastify" />
- <Link href="/docker" noBreadcrumb />
- <Link href="/nginx" />
- <Link href="/tools#server">... more</Link>

See also:
- <Link href="/renderPage" />
- <Link href="/tools#server" />
- <Link href="/deploy" />

<IntegrationHelp />


## Non-JavaScript Backend

You can use Vike with any non-JavaScript backend using the following setup:
 - Your non-JavaScript backend implements all the backend business logic while exposing a REST/GraphQL API.
 - Your Vike app uses that REST/GraphQL API to <Link href="/ssr">render your pages to HTML with SSR or SSG</Link>. (The client-side of your Vike app then <Link href="/hydration">hydrates</Link> the HTML into a rich interactive user interface.)

If want to use SSR then, in addition to your non-JavaScript server, you'll need to deploy a JavaScript SSR server (with Node.js/Deno/Bun, or with an edge worker). Since that JavaScript server is only responsible for server-side rendering your pages to HTML, you can simply deploy it to a serverless/edge platform such as Cloudflare which is inexpensive and scalable.

Alternatively, instead of using a JavaScript server, you can <Link href="/pre-rendering">pre-render</Link> your pages (SSG) while <Link href="/ssr">disabling SSR</Link>. In other words: you generate empty HTML shells that you statically deploy (using a <Link href="/static-hosts">static host</Link>, or using your own static assets deployment).

> The HTML must be generated by Vike because the UI is *completely* owned by React/Vue/Solid. You cannot generate the HTML using your non-JavaScript backend: React/Vue/Solid would otherwise throw a <Link href="/hydration-mismatch">hydration mismatch</Link>.

That way, you can use Vike with any backend:
- Java (Spring, Grails, ...)
- PHP (Laravel, Symfony, CakePHP, ...)
- Ruby on Rails
- Python (Django, Flask, FastAPI, ...)
- Elixir (Phoenix, ...)
- Go (Gin, Echo, Fiber, ...)
- Rust (Actix Web, Rocket, ...)
- Backend-as-a-Service (Firebase, ..)
- ...

Example:
- <Link href="/ruby-on-rails" />

<IntegrationHelp />


## See also

- <Link href="/vike-photon" />
- <Link href="/renderPage" />
